package exception;

public class TryCatchDemo {
    public static void main(String[] args) {
        System.out.println("程序开始了");
       try {
          // String line = null;
           String line = "";
           System.out.println(line.charAt(0));
//           System.out.println(line.length());
//       }catch (NullPointerException e){
//           System.out.println("出现空指针");
//       }catch (StringIndexOutOfBoundsException e ){
//           System.out.println("下标越界");
       }catch (NullPointerException | StringIndexOutOfBoundsException e){
           System.out.println("数组下标越界或者空指针");
       }
        System.out.println("程序结束");
    }
}
